package com.example.ccj.u.media;

import com.example.ccj.b.c.custom.image.MLocalMedia;
import com.example.ccj.u.ActivityUtils;
import com.example.ccj.u.LogUtils;
import com.luck.picture.lib.entity.LocalMedia;

import java.util.ArrayList;
import java.util.List;

public interface IPictureSelectResultListener2 extends IPictureSelectResultListener {

    void onResult(List<MLocalMedia> myImages);

    @Override
    default void onResult(ArrayList<LocalMedia> result) {
        List<MLocalMedia> myImages = new ArrayList<>();
        for (LocalMedia localMedia : result) {
            if (localMedia instanceof MLocalMedia) {
                myImages.add((MLocalMedia) localMedia);
            } else {
                MLocalMedia localMedia1 = MLocalMedia.generateLocalMedia(ActivityUtils.getTopActivity(),localMedia.getAvailablePath());
                myImages.add(localMedia1);
            }
        }
        onResult(myImages);
    }

    @Override
    default void onCancel() {
        IPictureSelectResultListener.super.onCancel();
    }
}
